/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package escr.persistencia;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author Aditardo
 */
@Entity
@Table(name = "usuario")
@NamedQueries({@NamedQuery(name = "Usuario.findByUsrCodigo", query = "SELECT u FROM Usuario u WHERE u.usrCodigo = :usrCodigo"), @NamedQuery(name = "Usuario.findByUsrApellido", query = "SELECT u FROM Usuario u WHERE u.usrApellido = :usrApellido"), @NamedQuery(name = "Usuario.findByUsrNombre", query = "SELECT u FROM Usuario u WHERE u.usrNombre = :usrNombre"), @NamedQuery(name = "Usuario.findByUsrLogin", query = "SELECT u FROM Usuario u WHERE u.usrLogin = :usrLogin"), @NamedQuery(name = "Usuario.findByUsrPassword", query = "SELECT u FROM Usuario u WHERE u.usrPassword = :usrPassword"), @NamedQuery(name = "Usuario.findByUsrEstado", query = "SELECT u FROM Usuario u WHERE u.usrEstado = :usrEstado"), @NamedQuery(name = "Usuario.findByUsrFecha", query = "SELECT u FROM Usuario u WHERE u.usrFecha = :usrFecha"), @NamedQuery(name = "Usuario.findByUsrHora", query = "SELECT u FROM Usuario u WHERE u.usrHora = :usrHora"), @NamedQuery(name = "Usuario.findByUsrResponsable", query = "SELECT u FROM Usuario u WHERE u.usrResponsable = :usrResponsable"), @NamedQuery(name = "Usuario.findByUsrTipmenu", query = "SELECT u FROM Usuario u WHERE u.usrTipmenu = :usrTipmenu"), @NamedQuery(name = "Usuario.findByUsrDatoi", query = "SELECT u FROM Usuario u WHERE u.usrDatoi = :usrDatoi")})
public class Usuario implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Column(name = "USR_CODIGO", nullable = false)
    private Integer usrCodigo;
    @Column(name = "USR_APELLIDO", nullable = false)
    private String usrApellido;
    @Column(name = "USR_NOMBRE", nullable = false)
    private String usrNombre;
    @Column(name = "USR_LOGIN", nullable = false)
    private String usrLogin;
    @Column(name = "USR_PASSWORD")
    private String usrPassword;
    @Column(name = "USR_ESTADO")
    private Integer usrEstado;
    @Column(name = "USR_FECHA")
    @Temporal(TemporalType.DATE)
    private Date usrFecha;
    @Column(name = "USR_HORA")
    @Temporal(TemporalType.TIME)
    private Date usrHora;
    @Column(name = "USR_RESPONSABLE", nullable = false)
    private String usrResponsable;
    @Column(name = "USR_TIPMENU")
    private Integer usrTipmenu;
    @Column(name = "USR_DATOI")
    private String usrDatoi;
    @JoinColumn(name = "EMP_CODIGO", referencedColumnName = "EMP_CODIGO")
    @ManyToOne
    private Empleado empCodigo;
    @JoinColumn(name = "TPU_CODIGO", referencedColumnName = "TPU_CODIGO")
    @ManyToOne
    private TipoUsuario tpuCodigo;

    public Usuario() {
    }

    public Usuario(Integer usrCodigo) {
        this.usrCodigo = usrCodigo;
    }

    public Usuario(Integer usrCodigo, String usrApellido, String usrNombre, String usrLogin, String usrResponsable) {
        this.usrCodigo = usrCodigo;
        this.usrApellido = usrApellido;
        this.usrNombre = usrNombre;
        this.usrLogin = usrLogin;
        this.usrResponsable = usrResponsable;
    }

    public Integer getUsrCodigo() {
        return usrCodigo;
    }

    public void setUsrCodigo(Integer usrCodigo) {
        this.usrCodigo = usrCodigo;
    }

    public String getUsrApellido() {
        return usrApellido;
    }

    public void setUsrApellido(String usrApellido) {
        this.usrApellido = usrApellido;
    }

    public String getUsrNombre() {
        return usrNombre;
    }

    public void setUsrNombre(String usrNombre) {
        this.usrNombre = usrNombre;
    }

    public String getUsrLogin() {
        return usrLogin;
    }

    public void setUsrLogin(String usrLogin) {
        this.usrLogin = usrLogin;
    }

    public String getUsrPassword() {
        return usrPassword;
    }

    public void setUsrPassword(String usrPassword) {
        this.usrPassword = usrPassword;
    }

    public Integer getUsrEstado() {
        return usrEstado;
    }

    public void setUsrEstado(Integer usrEstado) {
        this.usrEstado = usrEstado;
    }

    public Date getUsrFecha() {
        return usrFecha;
    }

    public void setUsrFecha(Date usrFecha) {
        this.usrFecha = usrFecha;
    }

    public Date getUsrHora() {
        return usrHora;
    }

    public void setUsrHora(Date usrHora) {
        this.usrHora = usrHora;
    }

    public String getUsrResponsable() {
        return usrResponsable;
    }

    public void setUsrResponsable(String usrResponsable) {
        this.usrResponsable = usrResponsable;
    }

    public Integer getUsrTipmenu() {
        return usrTipmenu;
    }

    public void setUsrTipmenu(Integer usrTipmenu) {
        this.usrTipmenu = usrTipmenu;
    }

    public String getUsrDatoi() {
        return usrDatoi;
    }

    public void setUsrDatoi(String usrDatoi) {
        this.usrDatoi = usrDatoi;
    }

    public Empleado getEmpCodigo() {
        return empCodigo;
    }

    public void setEmpCodigo(Empleado empCodigo) {
        this.empCodigo = empCodigo;
    }

    public TipoUsuario getTpuCodigo() {
        return tpuCodigo;
    }

    public void setTpuCodigo(TipoUsuario tpuCodigo) {
        this.tpuCodigo = tpuCodigo;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (usrCodigo != null ? usrCodigo.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Usuario)) {
            return false;
        }
        Usuario other = (Usuario) object;
        if ((this.usrCodigo == null && other.usrCodigo != null) || (this.usrCodigo != null && !this.usrCodigo.equals(other.usrCodigo))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "escr.persistencia.Usuario[usrCodigo=" + usrCodigo + "]";
    }

}
